<template>
    <view class="columnbox wdh-100 content" :class="{'noinfo':list.length==0}">
        <image v-if="list.length==0" style="width: 400rpx;margin-top: 200rpx;" src="/static/img/noinfo.png"
            mode="widthFix"></image>
        <template v-else>
            <view v-for="(item,index) in list" :key='index' class="one-info columnbox">
                <view class="rowbox wdh-100 spb">
                    <view class="name">{{item.companyName}}</view>
                    <view class="status" :class="{'tg':item.verified==3,'fail-title':item.verified==2}">
                        {{getStatus(item.verified)}}
                    </view>
                </view>
                <view class="rowbox wdh-100 spb" style="margin-top: 10rpx;">
                    <view class="num">{{item.creditCode}}</view>
                    <view @click="updateInfo(item.userId)" class="edit" v-if="item.verified==3||item.verified==2">修改
                    </view>
                </view>
                <view class="wdh-100 r-box" v-if="item.verified==2">
                    失败原因：{{item.remark||'暂无'}}
                </view>
            </view>
        </template>
        <view style="width: 100%;height: 200rpx;"></view>
        <view class="columnbox wdh-100 bottom-box">
            <view @click="toIden" class="send-btn wdh-100 rowbox">立即认证</view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                list: [],
                pageNum: 1,
                refreshflag: false,
                total: 0
            };
        },
        onLoad() {
            this.getList()
        },
        onShow() {
            if (this.refreshflag) {
                this.refreshflag = false
                this.pageNum = 1
                this.list = []
                this.getList()
            }
        },
        onReachBottom() {
            if (this.list.length < this.total) {
                this.pageNum++
                this.getList()
            }
        },
        methods: {
            updateInfo(id) {
                uni.navigateTo({
                    url: '/packageA/companyIden/apply?id=' + id
                })
            },
            getStatus(v) {
                return this.$getStatus(v)
            },
            toIden() {
                uni.navigateTo({
                    url: '/packageA/companyIden/apply'
                })
            },
            getList() {
                this.$req.get('/xcx/busIcense/list', {
                    pageSize: 20,
                    pageNum: this.pageNum,
                }).then(res => {
                    this.list = this.list.concat(res.data.rows)
                    this.total = res.data.total
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
    .content {
        font-family: PingFang SC;
        background: #f7f8fa;
        min-height: 100vh;
        justify-content: flex-start;
    }

    .one-info {
        background: #fff;
        width: 700rpx;
        padding: 32rpx 32rpx;
        margin: 10rpx 0;
        border-radius: 10rpx;
        line-height: 40rpx;
    }

    .name {
        font-size: 28rpx;
        font-weight: bold;
    }

    .status {
        font-size: 24rpx;
    }

    .num {
        font-size: 24rpx;
        color: #9d9d9d;
    }

    .edit {
        font-size: 28rpx;
        color: #9d9d9d;
    }

    .noinfo {
        background: #fff;
    }

    .tg {
        color: #17698F;
    }

    .fail-title {
        color: #BD3124;
    }

    .r-box {
        border-top: #f4f4f4 solid 1px;
        font-size: 28rpx;
        margin-top: 20rpx;
        padding-top: 20rpx;
    }
</style>